<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>EQEmu</title>
    <link rel="stylesheet" type="text/css" href="style/style.css"/>
    <script src="scripts/jquery.js"></script>
</head>
<body>
    <div class="container">
        <?do("templates/scripts/menu.pl");?>
        <div id="main_content" class="main">
        <h2 align="center">Petition Management</h2>
        <?
            $q = "SELECT accountname, charname, petitiontext, FROM_UNIXTIME(senttime, '%Y-%m-%d %h:%m %p') AS senttime FROM petitions";
            my $res = $EQDB->query($q);
            if ($res) {
                print "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" class=\"styled_table\">\n";
                print "\t<tr>\n";
                print "\t\t<th width=1 nowrap>Account</th>\n";
                print "\t\t<th width=1 nowrap>Character</th>\n";
                print "\t\t<th>Text</th>\n";
                print "\t\t<th width=1 nowrap>Date/Time</th>\n";
                print "\t</tr>\n";
                while (my $row=$res->fetch_row_hash) {
                    print "\t<tr>\n";
                    print "\t\t<td><a href=\"account.html?name=$row->{accountname}\">$row->{accountname}</a></td>\n";
                    print "\t\t<td>$row->{charname}</td>\n";
                    print "\t\t<td align=\"left\">$row->{petitiontext}</td>\n";
                    print "\t\t<td>$row->{senttime}</td>\n";
                    print "\t</tr>\n";
                }
                print "</table>\n";
            } else {
                print "No petitions"
            }
        ?>
        </div>
    </div>
    <div class="footer">
        &copy 2012 EQEmu. All rights reserved.
    </div>
</body>
</html>
